package com.javaclimb.drug.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.javaclimb.drug.entity.Druginfo;
import com.javaclimb.drug.entity.ILogInfo;
import com.javaclimb.drug.mapper.LogInfoMapper;
import com.javaclimb.drug.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LogServiceImpl extends ServiceImpl<LogInfoMapper, ILogInfo> implements LogService {

    @Autowired
    LogInfoMapper logInfoMapper;
    @Override
    public IPage<ILogInfo> selectLogPage(int pageNum, int pageSize, String param) {
        QueryWrapper<ILogInfo> queryWrapper = new QueryWrapper<>();
        if(StringUtils.isNotEmpty(param)){
            queryWrapper.like("name",param);
        }
        Page<ILogInfo> page = new Page<>(pageNum,pageSize);
        return logInfoMapper.selectPage(page,queryWrapper);

    }

    @Override
    public int LogInfo(ILogInfo logInfo) {
        return logInfoMapper.insert(logInfo);

    }
}
